﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ArrayConsoleRender
{
    public class ConsolePainter
    {
        public static void PrepareScren()
        {
            Console.SetWindowSize(100, 50);
        }
        public static void DrawArray(int[] arr, int maxValue)
        {
            int lenght = arr.Length;
            Console.SetCursorPosition(0, 0);
            int heightScale = 1;
            int top = 0;
            int maxHeight = 55;
            int wightScale = 1;
            if (lenght > 100)
            {
                wightScale += lenght / 100;
            }
            if (maxValue > maxHeight)
            {
                heightScale += maxValue / maxHeight;
            }
            for (int i = 0; i < lenght / wightScale; i++)
            {
                top = maxHeight - (arr[i] / heightScale);
                Console.SetCursorPosition(i, top);
                Console.Write(".");
                Console.SetCursorPosition(i, maxHeight);
                Console.Write("_");
            }
            Thread.Sleep(10);

        }
    }
}
